import Vue from 'vue'
import Router from 'vue-router'

// import Home from '@/view/index/home' 
// import Index from '@/view/index/data' 
// import Login from '@/view/index/login' 
// import Entirety from '@/view/index/entirety' 
// import My from '@/view/index/my' 
// import ChangePassword from '@/view/index/changePassword' 
// import MoreList from '@/view/index/moreList' 
// import EquipList from '@/view/index/equipList' 
// import AboutUs from '@/view/index/aboutUs' 
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const Home = () => import('@/view/index/home')
const Index = () => import('@/view/index/data')
const Login = () => import('@/view/index/login')
const Entirety = () => import('@/view/index/entirety')
const My = () => import('@/view/index/my')
const ChangePassword = () => import('@/view/index/changePassword')
const MoreList = () => import('@/view/index/moreList')
const EquipList = () => import('@/view/index/equipList')
const AboutUs = () => import('@/view/index/aboutUs') 
const Setting = () => import('@/view/index/Setting') 
const MessageList = () => import('@/view/index/messageList') 
const MessageDetail = () => import('@/view/index/messageDetail') 
const MyShops  = () => import('@/view/index/myShops') 
const MyInvoice  = () => import('@/view/index/myInvoice') 
const MyInvoiceDetail  = () => import('@/view/index/myInvoiceDetail') 
const InvoiceOrderAdd  = () => import('@/view/index/invoiceOrderAdd') 
const ChooseInvoice  = () => import('@/view/index/chooseInvoice') 
const ShopMng  = () => import('@/view/index/shopMng') 
const AddShop  = () => import('@/view/index/addShop') 
const ShopDetail  = () => import('@/view/index/shopDetail') 
const AdminMng  = () => import('@/view/index/adminMng') 
const AdminDetail  = () => import('@/view/index/adminDetail') 
const AdminAdd  = () => import('@/view/index/adminAdd') 
const ChooseShop  = () => import('@/view/index/chooseShop') 

const PurchaseIndex  = () => import('@/view/index/purchaseIndex') 
const PurchaseOrder  = () => import('@/view/index/purchaseOrder') 
const PurchaseOrderDetail  = () => import('@/view/index/purchaseOrderDetail')
const AddOrder  = () => import('@/view/index/addOrder')
const ChooseGoods  = () => import('@/view/index/chooseGoods')
const StockIndex  = () => import('@/view/index/stockIndex')
const StockList  = () => import('@/view/index/stockList')
const PurchasingStatistics  = () => import('@/view/index/purchasingStatistics')
const SaleOrder  = () => import('@/view/index/saleOrder')
const SaleOrderDetail  = () => import('@/view/index/saleOrderDetail')
const GoodssaleRanking  = () => import('@/view/index/goodssaleRanking')
const ShopSaleRanking  = () => import('@/view/index/shopSaleRanking')
const ShopStockDailyData  = () => import('@/view/index/shopStockDailyData')
const ShopStockDailyDetail  = () => import('@/view/index/shopStockDailyDetail')
const ShopOperateDailyData  = () => import('@/view/index/ShopOperateDailyData')
const ShopStock  = () => import('@/view/index/shopStock')
const AdminEdit  = () => import('@/view/index/adminEdit')
const ShopEdit  = () => import('@/view/index/shopEdit')
const WarehouseAdd  = () => import('@/view/index/warehouseAdd')
const WarehouseEdit  = () => import('@/view/index/warehouseEdit')
const WarehouseDetail  = () => import('@/view/index/warehouseDetail')
const WarehouseList  = () => import('@/view/index/warehouseList')
const WarehouseReple  = () => import('@/view/index/warehouseReple')
const ChooseWarehouse  = () => import('@/view/index/chooseWarehouse')
const WarehouseOrder  = () => import('@/view/index/warehouseOrder')
const ChooseReplenisGoods  = () => import('@/view/index/chooseReplenisGoods')
const WarehouseOrderDetail  = () => import('@/view/index/warehouseOrderDetail') 
const Hlep  = () => import('@/view/index/hlep') 
const ShopSaleList  = () => import('@/view/index/shopSaleList') 
const GoodsSaleList  = () => import('@/view/index/goodsSaleList') 
const SaleOrderShops  = () => import('@/view/index/saleOrderShops') 
const StockSet  = () => import('@/view/index/stockSet')


//店主
const shopkeeperIndex  = () => import('@/view/index/shopkeeperIndex')
const feedBack  = () => import('@/view/shopkeeper/feedBack')
const shopOrders  = () => import('@/view/shopkeeper/shopOrders')
const feedBackToggle  = () => import('@/view/shopkeeper/feedBackToggle')
const shopIncome  = () => import('@/view/shopkeeper/shopIncome')
const shopkeeperShopDetail  = () => import('@/view/shopkeeper/shopDetail')
const shopkeeperShopEdit  = () => import('@/view/shopkeeper/shopEdit')
const shopkeeperStockList  = () => import('@/view/shopkeeper/stockList')
const stockPDList  = () => import('@/view/shopkeeper/stockPDList')
const incomeList  = () => import('@/view/shopkeeper/incomeList')
const shopSaleOrder  = () => import('@/view/shopkeeper/shopSaleOrder')

//菜品管理
const FoodList  = () => import('@/view/foodMng/list')
const ChooseFoodsShop  = () => import('@/view/foodMng/choosShop')
const FoodDetail  = () => import('@/view/foodMng/detail')


Vue.use(Router)
const router = new Router({
  mode: 'history',
  // base: '/lottery3/',
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home,
      redirect:'/entirety', // 设置默认打开的页面
      children:[
        {
          path: '/entirety',
          name: 'Entirety',
          component: Entirety,
          meta: { title: '数据概览', keepAlive:true }
        },
        {
          path: '/index',
          name: 'Index',
          component: Index,
          meta: { title: '统计', keepAlive:true }
        },
        {
          path: '/my',
          name: 'My',
          component: My,
          meta: { title: '我的' } 
        },

        {
          path: '/shopkeeperIndex',
          name: 'shopkeeperIndex',
          component: shopkeeperIndex,
          meta: { title: '数据概览', keepAlive:true }
        },

      ]
    },
    {
      path: '/login',
      name: 'Login',
      component: Login,
      meta: { title: '登录' }
    },
    {
      path: '/shopIncome',
      name: 'shopIncome',
      component: shopIncome,
      meta: { title: '店铺收入' }
    },
    {
      path: '/incomeList',
      name: 'incomeList',
      component: incomeList,
      meta: { title: '收入列表' }
    },
    {
      path: '/shopSaleOrder',
      name: 'shopSaleOrder',
      component: shopSaleOrder,
      meta: { title: '收入列表' }
    },
    
    {
      path: '/feedBackToggle',
      name: 'feedBackToggle',
      component: feedBackToggle,
      meta: { title: '反馈详情' }
    },
    {
      path: '/stockPDList',
      name: 'stockPDList',
      component: stockPDList,
      meta: { title: '库存盘点记录' }
    },
    
    {
      path: '/shopkeeperShopDetail',
      name: 'shopkeeperShopDetail',
      component: shopkeeperShopDetail,
      meta: { title: '店铺详情' }
    },
    {
      path: '/shopkeeperShopEdit',
      name: 'shopkeeperShopEdit',
      component: shopkeeperShopEdit,
      meta: { title: '修改店铺' }
    },
    {
      path: '/shopkeeperStockList',
      name: 'shopkeeperStockList',
      component: shopkeeperStockList,
      meta: { title: '库存' }
    },
    {
      path: '/changePassword',
      name: 'ChangePassword',
      component: ChangePassword,
      meta: { title: '修改密码' }
    },
    {
      path: '/feedBack',
      name: 'feedBack',
      component: feedBack,
      meta: { title: '用户反馈' }
    },
    {
      path: '/shopOrders',
      name: 'shopOrders',
      component: shopOrders,
      meta: { title: '当前订单' }
    },
    {
      path: '/moreList',
      name: 'MoreList',
      component: MoreList,
      meta: { title: '销售明细' }
    },
    {
      path: '/equipList',
      name: 'EquipList',
      component: EquipList,
      meta: { title: '设备明细' }
    },
    {
      path: '/aboutUs',
      name: 'AboutUs',
      component: AboutUs,
      meta: { title: '关于我们' }
    },
    {
      path: '/foodList',
      name: 'FoodList',
      component: FoodList,
      meta: { title: '菜品列表' }
    },
    {
      path: '/foodDetail',
      name: 'FoodDetail',
      component: FoodDetail,
      meta: { title: '菜品详情' }
    },
    {
      path: '/chooseFoodsShop',
      name: 'ChooseFoodsShop',
      component: ChooseFoodsShop,
      meta: { title: '选择店铺' }
    },
    
    
    {
      path: '/setting',
      name: 'Setting',
      component: Setting,
      meta: { title: '设置' }
    },
    {
      path: '/messageList',
      name: 'MessageList',
      component: MessageList,
      meta: { title: '我的消息' }
    },
    {
      path: '/messageDetail',
      name: 'MessageDetail',
      component: MessageDetail,
      meta: { title: '消息详情' }
    },
    {
      path: '/myShops',
      name: 'MyShops',
      component: MyShops,
      meta: { title: '消息详情' }
    },
    {
      path: '/myInvoice',
      name: 'MyInvoice',
      component: MyInvoice,
      meta: { title: '我的发票' }
    },
    {
      path: '/myInvoiceDetail',
      name: 'MyInvoiceDetail',
      component: MyInvoiceDetail,
      meta: { title: '发票详情' }
    },
    {
      path: '/invoiceOrderAdd',
      name: 'InvoiceOrderAdd',
      component: InvoiceOrderAdd,
      meta: { title: '发票申请', keepAlive:true }
    },
    {
      path: '/chooseInvoice',
      name: 'ChooseInvoice',
      component: ChooseInvoice,
      meta: { title: '选择发票' }
    },
    {
      path: '/chooseReplenisGoods',
      name: 'ChooseReplenisGoods',
      component: ChooseReplenisGoods,
      meta: { title: '选择补货商品' }
    },
    {
      path: '/shopMng',
      name: 'ShopMng',
      component: ShopMng,
      meta: { title: '店铺列表' }
    },
    {
      path: '/addShop',
      name: 'AddShop',
      component: AddShop,
      meta: { title: '新建店铺'  , keepAlive:true}
    },
    {
      path: '/shopDetail',
      name: 'ShopDetail',
      component: ShopDetail,
      meta: { title: '店铺详情' }
    },
    {
      path: '/shopEdit',
      name: 'ShopEdit',
      component: ShopEdit,
      meta: { title: '修改店铺' , keepAlive:true }
    },
    {
      path: '/warehouseAdd',
      name: 'WarehouseAdd',
      component: WarehouseAdd,
      meta: { title: '仓库添加' }
    },{
      path: '/warehouseEdit',
      name: 'WarehouseEdit',
      component: WarehouseEdit,
      meta: { title: '修改仓库' }
    },
    {
      path: '/warehouseDetail',
      name: 'WarehouseDetail',
      component: WarehouseDetail,
      meta: { title: '仓库详情' }
    },
    {
      path: '/warehouseOrder',
      name: 'WarehouseOrder',
      component: WarehouseOrder,
      meta: { title: '补货订单' }
    },
    {
      path: '/warehouseOrderDetail',
      name: 'WarehouseOrderDetail',
      component: WarehouseOrderDetail,
      meta: { title: '补货订单详情' }
    },
    
    {
      path: '/warehouseList',
      name: 'WarehouseList',
      component: WarehouseList,
      meta: { title: '补货仓库' }
    },
    
    {
      path: '/warehouseReple',
      name: 'WarehouseReple',
      component: WarehouseReple,
      meta: { title: '店铺补货' }
    },
    
    {
      path: '/adminMng',
      name: 'AdminMng',
      component: AdminMng,
      meta: { title: '管理员列表' }
    },
    {
      path: '/adminDetail',
      name: 'AdminDetail',
      component: AdminDetail,
      meta: { title: '管理员详情' }
    },
    {
      path: '/adminAdd',
      name: 'AdminAdd',
      component: AdminAdd,
      meta: { title: '新增管理员', keepAlive:true}
    },
    {
      path: '/adminEdit',
      name: 'AdminEdit',
      component: AdminEdit,
      meta: { title: '修改管理员信息', keepAlive:true}
    },
    
    {
      path: '/chooseShop',
      name: 'ChooseShop',
      component: ChooseShop,
      meta: { title: '店铺选择' }
    },
    {
      path: '/chooseWarehouse',
      name: 'ChooseWarehouse',
      component: ChooseWarehouse,
      meta: { title: '选择仓库' }
    },
    {
      path: '/purchaseIndex',
      name: 'PurchaseIndex',
      component: PurchaseIndex,
      meta: { title: '采购订单' }
    },
    {
      path: '/purchaseOrder',
      name: 'PurchaseOrder',
      component: PurchaseOrder,
      meta: { title: '采购订单' }
    },
    {
      path: '/purchaseOrderDetail',
      name: 'PurchaseOrderDetail',
      component: PurchaseOrderDetail,
      meta: { title: '采购订单详情' }
    },
    {
      path: '/addOrder',
      name: 'AddOrder',
      component: AddOrder,
      meta: { title: '新增采购订单', keepAlive:true}
    }, 
    {
      path: '/chooseGoods',
      name: 'ChooseGoods',
      component: ChooseGoods,
      meta: { title: '选择商品' }
    }, 
    {
      path: '/purchasingStatistics',
      name: 'PurchasingStatistics',
      component: PurchasingStatistics,
      meta: { title: '采购统计' }
    }, 
    {
      path: '/saleOrder',
      name: 'SaleOrder',
      component: SaleOrder,
      meta: { title: '销售订单' }
    }, 
    {
      path: '/saleOrderShops',
      name: 'SaleOrderShops',
      component: SaleOrderShops,
      meta: { title: '销售订单' }
    }, 
    
    {
      path: '/saleOrderDetail',
      name: 'SaleOrderDetail ',
      component: SaleOrderDetail,
      meta: { title: '销售订单详情' }
    }, 
    {
      path: '/goodssaleRanking',
      name: 'GoodssaleRanking ',
      component: GoodssaleRanking,
      meta: { title: '商品销售排行统计' }
    },
    {
      path: '/goodsSaleList',
      name: 'GoodsSaleList ',
      component: GoodsSaleList,
      meta: { title: '商品销售统计' }
    }, 
    {
      path: '/shopSaleRanking',
      name: 'ShopSaleRanking ',
      component: ShopSaleRanking,
      meta: { title: '店铺销售排行统计' }
    }, 
    {
      path: '/shopSaleList',
      name: 'ShopSaleList ',
      component: ShopSaleList,
      meta: { title: '店铺销售统计' }
    }, 
    
    {
      path: '/shopStockDailyData',
      name: 'ShopStockDailyData ',
      component: ShopStockDailyData,
      meta: { title: '店铺库存日报表' }
    }, 
    {
      path: '/shopStockDailyDetail',
      name: 'ShopStockDailyDetail ',
      component: ShopStockDailyDetail,
      meta: { title: '店铺库存日报表' }
    }, 
    {
      path: '/shopOperateDailyData',
      name: 'ShopOperateDailyData ',
      component: ShopOperateDailyData,
      meta: { title: '店铺运营日报表' }
    },  
    {
      path: '/stockIndex',
      name: 'StockIndex',
      component: StockIndex,
      meta: { title: '库存' }
    },
    {
      path: '/stockList',
      name: 'StockList',
      component: StockList,
      meta: { title: '库存列表' }
    }, 
    {
      path: '/stockSet',
      name: 'StockSet',
      component: StockSet,
      meta: { title: '库存设置' }
    }, 
    {
      path: '/shopStock',
      name: 'ShopStock',
      component: ShopStock,
      meta: { title: '店铺库存' }
    },
    {
      path: '/hlep',
      name: 'Hlep',
      component: Hlep,
      meta: { title: '帮助' }
    },
    
  ],
  
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0}
  }
})


export default router;